﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/SiteAdmin.Master" Inherits="System.Web.Mvc.ViewPage<Beeldbankmvc.ViewModels.ReportReactionsPageViewModel>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">Helpdesk rapportage</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <script language="javascript" type="text/javascript">
        $(function ()
            {
                $("#MoveRight,#MoveLeft").click(function (event)
                    {
                        var id = $(event.target).attr("id");
                        var selectFrom = id == "MoveRight" ? "#AllCollectionItems" : "#SelectedCollectionItems";
                        var moveTo = id == "MoveRight" ? "#SelectedCollectionItems" : "#AllCollectionItems";

                        var selectedItems = $(selectFrom + " :selected").toArray();
                        $(moveTo).append(selectedItems);
                        selectedItems.remove;
                    }
                );
            }
        );

        $(function ()
            {
                $("#submit").click(function (event)
                    {
                        $("#SelectedCollectionItems *").attr("selected", "selected");
                    }
                );
            }
        );

        /* Dutch (UTF-8) initialisation for the jQuery UI date picker plugin. */
        /* Written by Mathias Bynens <http://mathiasbynens.be/> */
        jQuery
        (
            function($)
            {
                $.datepicker.regional['nl'] =
                {
                    closeText: 'Sluiten',
                    prevText: '←',
                    nextText: '→',
                    currentText: 'Vandaag',
                    monthNames: ['Januari', 'Februari', 'Maart', 'April', 'Mei', 'Juni', 'Juli', 'Augustus', 'September', 'Oktober', 'November', 'December'],
                    monthNamesShort: ['jan', 'feb', 'maa', 'apr', 'mei', 'jun', 'jul', 'aug', 'sep', 'okt', 'nov', 'dec'],
                    dayNames: ['Zondag', 'Maandag', 'Dinsdag', 'Woensdag', 'Donderdag', 'Vrijdag', 'Zaterdag'],
                    dayNamesShort: ['zon', 'maa', 'din', 'woe', 'don', 'vri', 'zat'],
                    dayNamesMin: ['zo', 'ma', 'di', 'wo', 'do', 'vr', 'za'],
                    weekHeader: 'Wk',
                    dateFormat: 'dd-mm-yy',
                    firstDay: 1,
                    isRTL: false,
                    showMonthAfterYear: false,
                    yearSuffix: ''
                };
                $.datepicker.setDefaults($.datepicker.regional['nl']);
            }
        );

        $(document).ready
        (
            function ()
            {
                var selected = null;

                $('#Report_From_Date').datepicker
                (
                    {
                        beforeShowDay: function (date)
                        {
                            if (selected != null && date.getTime() > selected.getTime() && (date.getTime() - selected.getTime()) < 12 * 24 * 3600 * 1000)
                            {
                                return [true, "highlighted"];
                            }
                            return [true, ""];
                        }
                    }
                );

                $('#Report_To_Date').datepicker
                (
                    {
                        beforeShowDay: function (date)
                        {
                            if (selected != null && date.getTime() > selected.getTime() && (date.getTime() - selected.getTime()) < 12 * 24 * 3600 * 1000)
                            {
                                return [true, "highlighted"];
                            }
                            return [true, ""];
                        }
                    }
                );

                $("#Report_From_Date").datepicker
                (
                    'option', 'onSelect', function ()
                    {
                    }
                );

                $("#Report_To_Date").datepicker
                (
                    'option', 'onSelect', function ()
                    {
                    }
                );

                $('#Report_From_Date').datepicker
                (
                    'setDate', new Date(<%: Model.fromDate.Year %>, <%: Model.fromDate.Month - 1 %>, <%: Model.fromDate.Day %>)
                );

                $('#Report_To_Date').datepicker
                (
                    'setDate', new Date(<%: Model.toDate.Year %>, <%: Model.toDate.Month - 1 %>, <%: Model.toDate.Day %>)
                );

            }
        );
    </script>
    <div id="register">
        <% Html.RenderAction("AdminMenu", "Miscellaneous"); %>
        <h2>Helpdesk rapportage</h2>
        <% using (Html.BeginForm())
           { %>
             <table>
                <tr>
                    <td>
                        <fieldset>
                            Van:
                            <input id="Report_From_Date" name="Report.From_Date" type="text" style="width: 85px" />
                            Tot:
                            <input id="Report_To_Date" name="Report.To_Date" type="text" style="width: 85px" />
                            <input id="submit" type="submit" value="Filter" class="button" />
                        </fieldset>
                    </td>
                    <td style="width:100px">
                    </td>
                    <td style="vertical-align:middle">
                        <h4><%:Html.ActionLink("Vorige maand", "ReactionsPage", "Report", new { standardReport = "PrevMonth" }, null)%></h4>
                        <h4><%:Html.ActionLink("Vorig jaar", "ReactionsPage", "Report", new { standardReport = "PrevYear" }, null)%></h4>
                    </td>
                    <td style="vertical-align:middle">
                        <h4><%:Html.ActionLink("Deze maand", "ReactionsPage", "Report", new { standardReport = "CurMonth" }, null)%></h4>
                        <h4><%:Html.ActionLink("Dit jaar", "ReactionsPage", "Report", new { standardReport = "CurYear" }, null)%></h4>
                    </td>
                </tr>
            </table>
            <div class="reports" style="width: 646px;">
                <div style="float: left; display: inline-block; width: 215px;">
                    <% Html.RenderPartial("ReactionsStatusCount", Model.ReactionStatusCountModels); %>
                </div>
                <div style="float: left; display: inline-block; width: 215px;">
                    <% Html.RenderPartial("ReactionsTypeCount", Model.ReactionTypeCountModels); %>
                </div>
                <div style="float: left; display: inline-block; width: 215px;">
                    <% Html.RenderPartial("ReactionsCategoryCount", Model.ReactionCategoryCountModels); %>
                </div>
                <div style="display: inline-block; width: 640px;">
                    <% Html.RenderPartial("Reactions", Model.ReactionModel); %>
                    <p style="width: 100%; text-align: center; clear: both">
                        <%
                        int ReactionsPageIndex = 0;
                        while (Model.numberOfRowsReaction > (ReactionsPageIndex * Model.pageSize))
                        {
                        %>
                        <%:Html.ActionLink((ReactionsPageIndex + 1).ToString(), "ReactionsPage", "Report", new { reactionPageIndex = ReactionsPageIndex, sort = Request.QueryString["sort"] }, null)%>&nbsp;
                        <%
                            ReactionsPageIndex++;
                        }
                        %>
                    </p>
                </div>
                <div style="display: inline-block; width: 640px;">
                    <% Html.RenderPartial("MediaReactions", Model.MediaReactionModel); %>
                    <p style="width: 100%; text-align: center; clear: both">
                        <%
                        int MediaReactionsPageIndex = 0;
                        while (Model.numberOfRowsMediaReaction > (MediaReactionsPageIndex * Model.pageSize))
                        {
                        %>
                        <%:Html.ActionLink((MediaReactionsPageIndex + 1).ToString(), "ReactionsPage", "Report", new { mediareactionPageIndex = MediaReactionsPageIndex, sort = Request.QueryString["sort"] }, null)%>&nbsp;
                        <%
                            MediaReactionsPageIndex++;
                        }
                        %>
                    </p>
                </div>
            </div>
        <% } %>
    </div>
</asp:Content>
